import { combineReducers } from "@reduxjs/toolkit";
import { loginUserSlice } from "./loginUser.tsx";
import storage from "redux-persist/lib/storage";
import { persistReducer } from "redux-persist";

const rootReducer = combineReducers({
  loginUser: loginUserSlice.reducer,
});

const persistConfig = {
  key: "root",
  storage,
  whitelist: ["loginUser"], // 指定需要持久化的 reducer 键名
};

const persistedReducer = persistReducer(persistConfig, rootReducer);

export default persistedReducer;
